﻿@{
    Layout = null;
}

<!DOCTYPE html>


<html lang="zh-cn" class="password_page">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>房都市 - 经纪人密码修改</title>

    <!-- Bootstrap基础样式 -->
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css" />
    <!-- 主题样式-->
    <link rel="stylesheet" href="/Content/css/green.css" />
    <!-- tooltip -->
    <link rel="stylesheet" href="/lib/qtip2/jquery.qtip.min.css" />
    <!-- 主要样式 -->
    <link rel="stylesheet" href="/Content/css/style.css" />

    <link rel="stylesheet" href="/Content/css/jquery.inputbox.css" />
    <!-- favicon -->
    <link rel="shortcut icon" href="/Content/fangdushi.ico" />

    <link href='/Content/css/googlefonts/OpenSans.css' rel='stylesheet' type='text/css'>


    <!--[if lte IE 8]>
            <link rel="stylesheet" href="/Content/css/ie.css" />
        <![endif]-->
    <!--[if lt IE 9]>
        <script src="/Scripts/ie/html5.js"></script>
        <script src="/Scripts/ie/respond.min.js"></script>
    <![endif]-->


</head>
<body>
    <div class="password_box">

        <form action="" method="post" id="password_form" style="display:block">
            <div class="top_b">密码修改</div>
            <div class="cnt_b">
                <div class="form-group">
                    <div class="input-group has-feedback" id="divMobile">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-user"></i></span>
                        <input class="form-control input-sm" disabled type="text" id="txtMobile" name="txtMobile" placeholder="手机号" value="@ViewData["FMobile"].ToString()" />
                    </div>
                </div>
                <div class="form-group has-feedback" id="divOldPassword">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-lock"></i></span>
                        <input class="form-control input-sm" type="password" id="txtOldPassword" name="txtOldPassword" placeholder="请输入旧密码" value="" />
                    </div>
                    <label id="lblOldPasswordStatus" style="color: #C62626; font-weight: bold" class="sr-only">请输入旧密码</label>
                </div>
                <div class="form-group has-feedback" id="divPassword">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-lock"></i></span>
                        <input class="form-control input-sm" type="password" id="txtPassword" name="txtPassword" placeholder="请输入新密码" value="" />
                    </div>
                    <label id="lblPasswordStatus" style="color: #C62626; font-weight: bold" class="sr-only">请输入新密码</label>
                </div>
                <div class="form-group has-feedback" id="divPasswordConfirm">
                    <div class="input-group">
                        <span class="input-group-addon input-sm"><i class="glyphicon glyphicon-lock"></i></span>
                        <input class="form-control input-sm" type="password" id="txtPasswordConfirm" name="txtPasswordConfirm" placeholder="请输入确认密码" value="" />
                    </div>
                    <label id="lblPasswordConfirmStatus" style="color: #C62626; font-weight: bold" class="sr-only">请输入确认密码</label>
                    <label id="lblPasswordConfirmStatus1" style="color: #C62626; font-weight: bold" class="sr-only">两次输入密码不一致</label>
                </div>
            </div>
            <div class="btm_b clearfix">
                <button class="btn btn-default btn-sm pull-right" type="button" id="btnOK">确定</button>
                @*<span class="link_reg"><a href="/Realtor/Register">没有注册？点此进行注册</a></span>*@
            </div>
        </form>
       

    </div>

    <script src="/Scripts/jquery.min.js"></script>
   
    <script src="/Scripts/ie/jquery.placeholder.js"></script>

    <script src="/Scripts/jquery.form.js"></script>


    <script src="/Scripts/json2.js"></script>

    <script src="/bootstrap/js/bootstrap.min.js"></script>


    <script>
        $(document).ready(function () {
            $('input, textarea').placeholder();

            document.onkeydown = function (e) {
                var ev = document.all ? window.event : e;
                if (ev.keyCode == 13) {
                    $("#btnOK").click();
                }
            };
            $("#txtOldPassword").blur(function () {
                $("#lblOldPasswordStatus").addClass("sr-only");
                $("#divOldPassword").removeClass("has-error");
            });
            $("#txtPassword").blur(function () {
                $("#lblPasswordStatus").addClass("sr-only");
                $("#divPassword").removeClass("has-error");
            });
            $("#txtPasswordConfirm").blur(function () {
                $("#lblPasswordConfirmStatus").addClass("sr-only");
                $("#lblPasswordConfirmStatus1").addClass("sr-only");
                $("#divPasswordConfirm").removeClass("has-error");
            });

            $("#btnOK").click(function () {
                $("#divOldPassword").removeClass("has-error");
                $("#divPassword").removeClass("has-error");
                $("#divPasswordConfirm").removeClass("has-error");

                if ($.trim($("#txtOldPassword").val()) == "") {
                    $("#divOldPassword").addClass("has-error");
                    $("#lblOldPasswordStatus").removeClass("sr-only");
                    return false;
                }

                if ($.trim($("#txtPassword").val()) == "") {
                    $("#divPassword").addClass("has-error");
                    $("#lblPasswordStatus").removeClass("sr-only");
                    return false;
                }

                if ($.trim($("#txtPasswordConfirm").val()) == "") {
                    $("#divPasswordConfirm").addClass("has-error");
                    $("#lblPasswordConfirmStatus").removeClass("sr-only");
                    return false;
                }
                if ($.trim($("#txtPasswordConfirm").val()) != $.trim($("#txtPassword").val())) {
                    $("#divPasswordConfirm").addClass("has-error");
                    $("#lblPasswordConfirmStatus1").removeClass("sr-only");
                    return false;
                }
                else
                {
                    $("#lblPasswordConfirmStatus1").addClass("sr-only");
                }

                var options = {
                    cache: false,//
                    type: "POST",//发送方式
                    url: '/Realtor/SavePassword',//url地址
                    data: $('#password_form').serialize(),//.serialize()方法将form表单内所有数据组装
                    async: false,//同异步提交
                    error: function (request) {

                    },
                    success: function (date) {
                        var code = date["code"];
                        var msg = date["msg"];
                        $("#divShowMsg").html("");
                        if (code != 0) {
                            $("#btnOK").removeAttr("disabled")
                            parent.$("#divShowMsg").html(msg);
                            parent.$('#messageForm').modal('show');
                        }
                        else {
                            msg = "密码修改成功"
                            $("#txtOldPassword").val("");
                            $("#txtPassword").val("");
                            $("#txtPasswordConfirm").val("");
                            $("#btnOK").removeAttr("disabled");
                            parent.$("#divShowMsg").html(msg);
                            parent.$('#messageForm').modal('show');
                        }
                    },
                    dataType: "json"
                }
               $("#btnOK").attr("disabled", "disabled");
               $("#password_form").ajaxSubmit(options);
              
            });

            
        });



    </script>

</body>


</html>

